package com.ruoyi.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.domain.BsMenpiaoNum;
import com.ruoyi.system.domain.BsMenpiaoTime;
import com.ruoyi.system.service.BsMenpiaoNumService;
import com.ruoyi.system.service.BsMenpiaoTimeService;
import com.ruoyi.system.mapper.BsMenpiaoTimeMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 *
 */
@Service
public class BsMenpiaoTimeServiceImpl extends ServiceImpl<BsMenpiaoTimeMapper, BsMenpiaoTime>
    implements BsMenpiaoTimeService{

    @Resource
    private BsMenpiaoNumService bsMenpiaoNumService;

    @Override
    public boolean removeByJingquId(Long jingquId) {
        LambdaQueryWrapper<BsMenpiaoTime> lqw = new LambdaQueryWrapper<>();
        lqw.eq(BsMenpiaoTime::getJingquId,jingquId);
        return remove(lqw);
    }

    @Override
    public List<BsMenpiaoTime> listByJingquId(Long jingquId) {
        LambdaQueryWrapper<BsMenpiaoTime> lqw = new LambdaQueryWrapper<>();
        lqw.eq(BsMenpiaoTime::getJingquId,jingquId);
        return list(lqw);
    }

    @Override
    public BsMenpiaoTime getEntityByNumId(Long menpiaoNumId) {
        BsMenpiaoNum menpiaoNum = bsMenpiaoNumService.getById(menpiaoNumId);
        return getById(menpiaoNum.getMenpiaoTimeId());
    }
}




